package cn.wolfcode.shop.seckill.mapper;


import cn.wolfcode.shop.seckill.domain.SeckillOrder;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SeckillOrderMapper {

    @Select("select * from t_seckill_order where good_id=#{goodId} and user_id=#{userId}")
    public SeckillOrder findByUserIdAndGoodId(@Param("userId") Long userId, @Param("goodId") Long goodId);

    @Insert("insert into t_seckill_order(user_id,good_id,order_no) values (#{userId},#{goodId},#{orderNo})")
    int createSeckillOrder(SeckillOrder seckillOrder);
    @Update("UPDATE t_order_info SET status = 3 where order_no = #{orderNo} AND status = 0")
    int updateStatus(@Param("orderNo") String orderNo);
}
